﻿using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;

namespace SpectrumAnalyser.Shell.Converters
{
    public class HeaderItemsCountConverter : IValueConverter
    {
        public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
        {
            var collection = values as IList;
            const string template = "{0} ({1})";
            if (!ReferenceEquals(collection, null))
            {
                return string.Format(template, parameter, collection.Count);
            }
            return string.Format(template, parameter, 0);
        }

        public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}